import { defineConfig, presetUno, presetIcons, presetAttributify, transformerVariantGroup } from 'unocss'

export default defineConfig({
  extendTheme: (theme) => {
    let addStyle = {
      // fontSize: {
      //   table: ['13px', '23px'],
      //   icon: ['2.4rem']
      // },
      // colors: {
      //   hover: '#1fb6ff',
      //   cardbar: 'rgba(91, 219, 246, 0.2)',
      // }
    }
    Object.keys(addStyle).forEach(key => Object.assign(theme[key], addStyle[key]))
  },
  presets: [
    presetUno(),
    presetIcons({
      collections: {
        carbon: () => import('@iconify-json/carbon/icons.json', { with: { type: 'json' } }).then(i => i.default),
        mdi: () => import('@iconify-json/mdi/icons.json', { with: { type: 'json' } }).then(i => i.default),
      },
      // 可选：调整图标默认样式
      extraProperties: {
        'display': 'inline-block',
        'vertical-align': 'text-top',
        'width': '1.2em',
        'height': '1.2em',
      }
    }),
    presetAttributify(),
  ],
  transformers: [
    transformerVariantGroup(),
  ],
})